/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.uefs.cedoc.controle.parteII;

import br.uefs.cedoc.db.parteII.DBParteII;

/**
 *
 * @author suporte
 */


import br.uefs.cedoc.controle.*;
import br.uefs.cedoc.db.exception.DBConnectionException;
import javax.servlet.*;
import javax.servlet.http.*;
import br.uefs.cedoc.db.*;
import br.uefs.cedoc.db.parteII.DBParteII;
import br.uefs.cedoc.entidades.*;
import java.sql.SQLException;
  
public class GetParteIICommand implements Command {
  private String next;

  public GetParteIICommand(String next) {
    this.next = next;
  }

    public String execute(HttpServletRequest req)
    throws CommandException {
        try {
            
            DBParteII dbparteII = new DBParteII();
            ParteIIBean parteII = new ParteIIBean();            
            //parteI.setIdparteI();
            int id = Integer.parseInt(req.getParameter("id"));
            parteII = dbparteII.listaParteII(id);
            //System.out.println("deletada = "+ parteI.getIdparteI()+ "N= "+parteI.getParteII());
            req.setAttribute("parteII",parteII);

            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (DBConnectionException ex) {
                ex.printStackTrace();
            }

            req.setAttribute("status.msg", "tetes");
            
            return next;

    }
}


